home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / fax / src / util / dpsprinter.ps < prev    next >
Text File  |  1994-08-01  |  3KB  |  112 lines

  1. %!
  2. %%Title: dpsprinter.ps -- DPS prolog to emulate some printer features.
  3.  
  4. %%Notice: Copyright (c) 1989 Adobe Systems Incorporated.  All rights reserved.
  5.  
  6. % $Revision: 1.2 $
  7. % $Date: 1991/05/23 12:50:28 $
  8.  
  9. %
  10. % This file makes a number of definitions that are technically system specific
  11. % but are used by many existing PostScript language drivers that were written
  12. % without sufficient attention to the specification.
  13. % This prolog ensures that serverdict, exitserver, and assorted statusdict 
  14. % operators are defined as expected.  The flushfile operator is also redefined
  15. % to allow Macintosh files with a prepended Laser Prep file to work properly.
  16. % There is one special "feature" definition.  The ASCII character \004
  17. % (CTRL-D) is defined as a no-op operator in case the prolog contains
  18. % one to indicate end-of-file in some contexts.
  19. %%BeginProcSet: DPSPrinter 1 0
  20.  
  21. /serverdict where {%if
  22.   pop
  23. } {%else
  24.   /serverdict 1 dict def
  25. } ifelse
  26.  
  27. serverdict /exitserver known not {
  28.   % NOTE: We let the usual invalidaccess error occur if serverdict is not
  29.   %       writeable and exitserver is not known.  This is unlikely because
  30.   %       either serverdict was just created (above) or it already existed
  31.   %       in which case exitserver should have been defined.
  32.   serverdict /exitserver
  33.     % int exitserver --
  34.   {
  35.     0 ne {
  36.       /exitserver errordict /invalidaccess get exec
  37.     } if
  38.     {{end} loop} stopped pop    % Clear dictstack
  39.     clear
  40.   } bind put
  41. } if
  42.  
  43. statusdict /execjob known not {
  44.   statusdict /execjob {exec} bind put
  45. } if
  46.  
  47. userdict /legal known not {
  48.   userdict /legal {} put
  49. } if
  50.  
  51. userdict /letter known not {
  52.   userdict /letter {} put
  53. } if
  54.  
  55. statusdict /pagecount known not {
  56.   statusdict /pagecount 0 put
  57. } if
  58.  
  59. statusdict /printername known not {
  60.   statusdict /printername (DPS) put
  61. } if
  62.  
  63. statusdict /setjobtimeout known not {
  64.   statusdict /setjobtimeout {pop} bind put
  65. } if
  66.  
  67. statusdict /setrealdevice known not {
  68.   statusdict /setrealdevice {} put
  69. } if
  70.  
  71. statusdict /waittimeout known not {
  72.   statusdict /waittimeout 600 put
  73. } if
  74.  
  75. % The Mac Laser Prep file executes the flushfile operator to get to the end
  76. % of the prolog.  When documents are saved with the prolog attached, the
  77. % flushfile consumes the document and nothing is printed.  To get around this
  78. % problem the definition of flushfile is changed below to consume bytes of
  79. % input until a PostScript language comment (%) character is found.  The
  80. % rest of the line is then consumed before the revised flushfile terminates.
  81.  
  82. /*flushfile /flushfile load def
  83.  
  84. /flushfile
  85.   % file flushfile --
  86. {%def
  87.   {%loop -- search for next percent character in file
  88.     dup                % Copy file parameter
  89.     read {            % Consume character
  90.       8#045 eq {        % Check for ASCII percent character
  91.     exit            % Leave loop
  92.       } if
  93.     } if
  94.   } loop
  95.   {%loop -- search for newline character at end of comment
  96.     dup                % Copy file parameter
  97.     read {            % Consume character
  98.       8#012 eq {        % Check for ASCII newline character
  99.     exit            % Leave loop
  100.       } if
  101.     } if
  102.   } loop
  103.   pop                % Discard file parameterp
  104. } bind def
  105.  
  106. (\004) cvn {} def        % To ignore ^D at the end of prologs.
  107.  
  108. %%EndProcSet
  109.